package com.justnow.offer;

/**
 * @author justnow
 * Created on 2020-10-11
 * Description
 */
public class Youzan02 {
    public int numBSTs (int n) {
        // write code here
        int[] dp = new int[n+1];
        dp[0] = 1;
        dp[1] = 1;
        for (int i = 2; i <=n ; i++) {
            for (int root = 1; root <= i; root++) {
                dp[i] += dp[root - 1] * dp[i - root];
            }
        }
        return dp[n];
    }
}
